package TUILayer;
import java.util.Scanner;
import ControlLayer.*;


public class MainMenuUI
{
   private CustomerContainerUI cusUI;
   private StaffContainerUI staUI;
   private SaleUI saleUI;
   private ProductUI proUI;
   private OrderUI orderUI;
   public MainMenuUI()
   {
      
   }
    private int writeMainMenu()
    {
       Scanner keyboard = new Scanner(System.in);
       System.out.println("\f *** MainMenu ***");
       System.out.println(" (1) Customer");
       System.out.println(" (2) Staff");
       System.out.println(" (3) Product");
       System.out.println(" (4) Order");
       System.out.println(" (5) Sale");
       System.out.println(" (6) Close");
       System.out.print("\n Make your choise: ");
            
       int choise = keyboard.nextInt();
       return choise;
    }
    private void startCustomerContainerUI()
    {
        cusUI = new CustomerContainerUI();
        cusUI.start();
    }
    private void startStaffContainerUI()
    {
        staUI = new StaffContainerUI();
        staUI.start();
    }
    private void startProductUI()
    {
        proUI = new ProductUI();
        proUI.start();
    }
    private void startSaleUI()
    {
        saleUI = new SaleUI();
        saleUI.start();
    }
      private void startOrderUI()
    {
        orderUI = new OrderUI();
        orderUI.start();
    }

    public void mainMenuStart()
    {
       boolean exit=false;
       while (!exit)
       {
           int choise = writeMainMenu();
           if(choise == 1)
           {
               startCustomerContainerUI();
           }
           else
                {
                    if(choise == 2)
                    {
                        startStaffContainerUI();
                    }
                    else
                    {
                        if(choise == 3)
                        {
                            startProductUI();
                        }
                        else
                        {
                            if(choise == 5)
                            {
                                startSaleUI();
                            }
                            else
                            {
                                if (choise == 4)
                                {
                                    startOrderUI();
                                }
                                else
                                {
                                    writeEnd();
                                    exit = true;
                                }

                            }
                            
                        }
                       
                    }
                       
                }
       }
    }
    private void writeEnd()
    {
        System.out.println(" ** The System is shuting down **");
    }
    
    
    
}
  